package com.ljf.controller;

import com.ljf.bean.Freight;
import com.ljf.common.bean.ResultBean;
import com.ljf.common.controller.BaseController;
import com.ljf.common.group.V;
import com.ljf.service.FreightService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
@Api(tags = "货代管理")
public class FreightController extends BaseController {
    @Autowired
    FreightService freightService;
    @ApiOperation("保存货代信息")
    @PostMapping("freight")
     public ResultBean save(@Validated @RequestBody Freight freight ,BindingResult result){
        V.validate(result);
        int rs = freightService.save(freight);
        return saveResult(rs);
    }
}
